/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package servidor;

import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

/**
 *
 * @author Lucas
 */
public class Servidor extends Application {

    private static Servidor instancia;
    private Stage stage;

    public Servidor() {
        instancia = this;
    }

    public static Servidor getInstancia() {
        return instancia;
    }

    public void alteraTela(String fxml) throws IOException {
        Parent root = FXMLLoader.load(getClass().getResource(fxml));
        Scene scene = new Scene(root);
        stage.setScene(scene);
    }

    @Override
    public void start(Stage stage) throws Exception {
        Parent root = FXMLLoader.load(getClass().getResource("/view/Sample.fxml"));
        Scene scene = new Scene(root);
        stage.setScene(scene);
        stage.setTitle("**** Servidor Banco Imobiliario ****");
        stage.setResizable(false);
        stage.centerOnScreen();
        stage.getIcons().add(new Image("/imagens/server.png"));
        stage.show();
        this.stage = stage;
    }

    @Override
    public void stop() throws Exception {
        System.exit(0);
        super.stop();
    }

    /**
     * The main() method is ignored in correctly deployed JavaFX application.
     * main() serves only as fallback in case the application can not be
     * launched through deployment artifacts, e.g., in IDEs with limited FX
     * support. NetBeans ignores main().
     *
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }
}
